package com.example.demojimmer.domain.userauth.model.entity;

import org.babyfish.jimmer.sql.JoinTable;
import org.babyfish.jimmer.sql.ManyToMany;
import org.babyfish.jimmer.sql.MappedSuperclass;

import java.util.List;

/**
 * 保存关联关系映射
 * 用户表;
 *
 * @author : liuhailong
 * @date : 2024-7-9
 */
@MappedSuperclass
public interface StUserMapping {

    /**
     * JoinTable的
     * name中间表表名: BOOK_AUTHOR_MAPPING
     * joinColumnName中间表指向当前实体的外键的列名: BOOK_ID
     * inverseJoinColumnName中间表指向关联实体的外键的列名: AUTHOR_ID
     * <p>
     * 一个用户可以关联多个角色
     *
     * @return
     */
    @ManyToMany
    @JoinTable(
            name = "ST_USER_ROLE",
            joinColumnName = "USER_ID",
            inverseJoinColumnName = "ROLE_ID"
    )
    List<StRole> roles();


}